package cn.bgs.serviceedu.entity;

import cn.bgs.serviceutils.utils.DateUtils;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.util.Date;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 客户表
 * </p>
 *
 * @author YiChen
 * @since 2021-10-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Customer对象", description="客户表")
public class Customer implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "客户id")
    @TableId(value = "customer_id", type = IdType.AUTO)
    private Integer customerId;

    @ApiModelProperty(value = "客户姓名")
    private String customerName;

    @ApiModelProperty(value = "生日")
    private Date birthday;

    @ApiModelProperty(value = "账号")
    private String customerCode;

    @ApiModelProperty(value = "密码")
    private String passWord;


    @ApiModelProperty(value = "支付密码")
    private String payPwd;

    @ApiModelProperty(value = "性别（0女，1男）")
    private String sex;

    @ApiModelProperty(value = "用户头像")
    private String pthon;

    @ApiModelProperty(value = "用户邮箱")
    private String customerEmail;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date modifiedTime;

    @ApiModelProperty(value = "逻辑删除ID (0未删除 ,1已删除)")
    @TableLogic(value = "0",delval = "1")
    @TableField(fill = FieldFill.INSERT)
    private Integer deleteFlag;

    @ApiModelProperty(value = "年龄")
    @TableField(exist = false)
    private Integer age;

    public Integer getAge() {
        int age=0;
        try {
            age= DateUtils.getAge(birthday);
        }catch(Exception e) {
            e.printStackTrace();
        }
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }



}
